<script setup lang='ts'>
// import ShowCase from "./components/"
import EventCase from "./components/02.Vu3事件传递参数.vue";
import BindCase from "./components/03.Vu3b-bind的用法.vue";
import ForCase from "./components/04_vu3中的循环列表.vue"
 import ModelCase from './components/05_vue3中的双向绑定.vue'
 import ComputedCase from './components/06__Vue3中的计算属性.vue'
 import WatchCase from './components/07_Vu3Watch侦听器的用法.vue'
 import LifeCase from './components/08.生命周期的钩子函数.vue'
import ListV2Case from './components/09.Vue2的生命周期.vue'
import RefCase from './components/10.通过ref获取dom元素.vue'
import NBCase from './components/11_综合案例.vue'
import { ref } from "vue"
// const showCom = ref(true)
import HmHeader from "./components/HmHeader.vue"
import HmBody from "./components/HmBody.vue"
import HmFooter from "./components/HmFooter.vue"
import Parent from './components/12.父子通信中的父组件.vue'
import GrandFather from './components/14.跨代传值的爷爷组.vue'
import SlotCase from './components/17.Vue3中的默认插槽技术.vue'
import HmTable from './components/18.Vue3中封装table组件.vue'
import TestTable from './components/19.作用域插槽的简单版本.vue'
type PersonColumnArr = Array<{ label: string, field: string }>
type PersonArr = Array<{ id: number, username: string, age: number }>
const columns: PersonColumnArr = [
  { label: '序号', field: "id" },
  { label: '姓名', field: "username" },

  { label: '年纪', field: "age" },
  { label: '操作', field: "" },
]

const data = ref<PersonArr>([
  {
    id: 1,
    username: '王宁宁',
    age: 18
  },
  {
    id: 2,
    username: '宁王王',
    age: 18
  }, {
    id: 3,
    username: '宁王宁',
    age: 20
  }

])

const delRow = (row: { id: number, username: string, age: number }) => {
  data.value = data.value.filter(item => item.id !== row.id)
}
</script>
<template>
 
    <!-- <NBCase></NBCase> -->
    <!-- <div class="container">
    <HmHeader></HmHeader>
    <HmBody></HmBody>
    <HmFooter></HmFooter>
  </div> -->
  <!-- <Parent></Parent> -->
   <!-- <GrandFather></GrandFather> -->
   <!-- <SlotCase>
    <template #header>
      <h1>头部内容</h1>
    </template>
    <template #body>
      <h1>主体内容</h1>
    </template>
    <template #footer>
      <h1>底部内容</h1>
    </template>
    <template #default>
      匿名插槽的传入
    </template> -->
    
  <!-- </SlotCase> -->
  <!-- <HmTable :columns="columns" :data="data">
    <template #row="obj">
      <button>编辑</button>
      <button @click="delRow(obj.row)">删除</button>
    </template>

  </HmTable> -->
  <!-- <TestTable>
    <template #row="{ p }">
      <h2>姓名：{{ p.name }}, 年龄： {{ p.age }}</h2>
    </template> -->
    <!-- 子组件的数据 父组件 -传入插槽时使用 使用 -->
  <!-- </TestTable> -->



  <div class="container">
    <!-- 一级路由容器 -->
    <div class="nav">
      <router-link to="/home">去主页</router-link>
      <router-link to="/login">去登录</router-link>
    </div>
    <router-view></router-view>
  </div>

</template>
<style scoped>
.container {
  width: 50%;
  height: 50vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background-color: pink;
}
.nav a{
  margin-left: 100px;
  text-emphasis: none;
}

.router-link-active{
  font-style: 30px;
}
</style>